/*
 * $Id$
 *
 * Copyright ( c ) 2014 XuNuo Corporation. All Rights Reserved.
 *
 * This software is the confidential and proprietary information of XuNuo
 * Corporation ("Confidential Information").  You shall not disclose such
 * Confidential Information and shall use it only in accordance with the terms
 * of the license agreement you entered into with XuNuo Corporation or a XuNuo
 * authorized reseller (the "License Agreement"). XuNuo may make changes to the
 * Confidential Information from time to time. Such Confidential Information may
 * contain errors.
 *
 * EXCEPT AS EXPLICITLY SET FORTH IN THE LICENSE AGREEMENT, XuNuo DISCLAIMS ALL
 * WARRANTIES, COVENANTS, REPRESENTATIONS, INDEMNITIES, AND GUARANTEES WITH
 * RESPECT TO SOFTWARE AND DOCUMENTATION, WHETHER EXPRESS OR IMPLIED, WRITTEN OR
 * ORAL, STATUTORY OR OTHERWISE INCLUDING, WITHOUT LIMITATION, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY, TITLE, NON-INFRINGEMENT AND FITNESS FOR A
 * PARTICULAR PURPOSE. XuNuo DOES NOT WARRANT THAT END USER'S USE OF THE
 * SOFTWARE WILL BE UNINTERRUPTED, ERROR FREE OR SECURE.
 *
 * XuNuo SHALL NOT BE LIABLE TO END USER, OR ANY OTHER PERSON, CORPORATION OR
 * ENTITY FOR INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL
 * DAMAGES, OR DAMAGES FOR LOSS OF PROFITS, REVENUE, DATA OR USE, WHETHER IN AN
 * ACTION IN CONTRACT, TORT OR OTHERWISE, EVEN IF XuNuo HAS BEEN ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGES. XuNuo' TOTAL LIABILITY TO END USER SHALL NOT
 * EXCEED THE AMOUNTS PAID FOR THE XuNuo SOFTWARE BY END USER DURING THE PRIOR
 * TWELVE (12) MONTHS FROM THE DATE IN WHICH THE CLAIM AROSE.  BECAUSE SOME
 * STATES OR JURISDICTIONS DO NOT ALLOW LIMITATION OR EXCLUSION OF CONSEQUENTIAL
 * OR INCIDENTAL DAMAGES, THE ABOVE LIMITATION MAY NOT APPLY TO END USER.
 *
 * Copyright version 2.0
 */
package com.th.supcom.pds.phamapply.client.widget.phamapplydetail;

import com.extjs.gxt.ui.client.Style.HorizontalAlignment;
import com.extjs.gxt.ui.client.widget.form.FormPanel;
import com.extjs.gxt.ui.client.widget.layout.FormLayout;

/**
 * 药品请领界面中的摆药条件form
 * 
 * @author 杨冲
 */
public class PhamApplyDispenseConditionForm extends FormPanel
{
    private PhamApplyFields m_phamapplyFields;
    private PhamApplyButtons m_phamapplyButtons;

    /**
     * 构造函数
     */
    public PhamApplyDispenseConditionForm ()
    {
        setFrame (true);
    }

    /**
     * 注册文本组件
     * 
     * @param phamapplyFields
     */
    public void setPhamApplyFields (PhamApplyFields phamapplyFields)
    {

        this.m_phamapplyFields = phamapplyFields;
    }

    /**
     * 注册按钮组件
     * 
     * @param phamapplyButtons
     */
    public void setPhamApplyButtons (PhamApplyButtons phamapplyButtons)
    {

        this.m_phamapplyButtons = phamapplyButtons;
    }

    /**
     * 初始化UI
     */
    public void initUI ()
    {
        
        setHeaderVisible (false);
        setBodyBorder (false);
        setBorders (false);
        this.setHeight (70);
        FormLayout formLayout = new FormLayout ();
        formLayout.setLabelWidth (60);
        formLayout.setDefaultWidth (80);
        setLayout (formLayout);
        setButtonAlign (HorizontalAlignment.CENTER);
        initFields ();
    }

    /**
     * 初始化组件
     */
    public void initFields ()
    {
        add (m_phamapplyFields.getRepetitionBoxGroup ());
        add (m_phamapplyFields.getDispenseDays ());
        add (m_phamapplyFields.getDisepenseEndTime ());
        addButton (m_phamapplyButtons.getQueryBtn ());
        addButton (m_phamapplyButtons.getPrescClearBtn ());
    }
}
